<?php

class Damages_Methods_Data_Processes_ProcessType {

  /**
   *
   * @var int 
   */
  public $id;

  /**
   *
   * @var string 
   */
  public $name;

  /**
   *
   * @var string 
   */
  public $code;

  /**
   *
   * @var Damages_Methods_Data_Processes_Action 
   */
  public $actions = array();

  /**
   *
   * @var Damages_Methods_Data_Processes_ProcessType 
   */
  public $displayedProcess;

  public function __construct(DamagesProcessTypes $processType, $skipActions = false) {
    $this->id = $processType->getId();
    $this->name = $processType->getName();
    $this->code = $processType->getCode();
    if ($skipActions !== true)
      foreach ($processType->getProcessTypeActionss() as $processTypeAction) {
        $this->actions[] = new Damages_Methods_Data_Processes_Action($processTypeAction->getActions());
        $processTypeAction->clearAllReferences(true);
      }
    $processType->clearAllReferences(true);
  }

  public function setDisplayedProcess(DamagesProcessTypes $processType) {
    $this->displayedProcess = new self($processType, true);
  }

}